<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>AddCourse</title>
<script src="../jquery-3.5.1.js"></script>
<script src="../jquery.cookie.js"></script>
<script>
	var userid = sessionStorage.getItem('testKey');
	console.log(userid);

	window.onload = function() {
		$('#teacherid').val(userid);
	}
	if (userid == null || userid == "") {
		window.location = "/login.html";
	}
</script>
<style>
body {
	font-size: 75%;
	font-family: verdana, arial, 'sans serif';
	background-repeat: repeat-x;
	background-color: #FFFFF0;
}

h1 {
	font-size: 200%;
}

h2 {
	font-size: 140%;
}

h3 {
	font-size: 110%;
}

th {
	background-color: #ADD8E6;
}

ol {
	list-style: upper-roman;
}

ul {
	list-style-type: none;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background-color: #333;
}

li {
	float: left;
}

li a {
	display: block;
	color: white;
	text-align: center;
	padding: 14px 16px;
	text-decoration: none;
}

li a:hover {
	background-color: #111;
}

.active {
	background-color: #bfbfbf;
}

.foot {
	position: fixed;
	bottom: 5px;
	text-align: center;
	padding: 10px;
	border-radius: 6px;
	background-image: linear-gradient(to bottom right, #ffb21a, #ffdd99);
}
</style>
<script type="text/javascript">
	function addCourse() {
		console.log($("#semester").val()),
		$.ajax({
			url : '/courseTeaching',
			data : $('#add').serialize(),
			type : 'post',
			success : function(data) {

				if (data == "success")
					javascript: history.back(-1);
			},
			error : function(data, status) {

				console.log(status);
				console.log(data);
			},
		})
	}
</script>

</head>
<body>
	<ul>
		<!--导航栏 -->
		<li><a href="TeacherPage.html">主页</a></li>
		<li><a href="TchCourses.html">查看所教课程</a></li>
		<li><a href="LoggingScore.html">分数录入</a></li>
		<li><a class="active" href="AddCourse.html">增加课程</a></li>
		<li style="float: right"><a href="">修改密码</a></li>
	</ul>
	<br />
	<form  id="add">
		<table>
			<tr>
				<td>教师编号</td>
				<td><input type="text" name="teacher.tid" id="teacherid"
					readonly /></td>
			</tr>
			<tr>
				<td>课程id</td>
				<td><input type="text" name="course.id" id="cid" /></td>
			</tr>
			<tr>
				<td>开课学期</td>
				<td>
				
				<select name="semester" id="semester">
				<option value="春季">春季
				<option value="夏季">夏季
				<option value="秋季">秋季
				<option value="冬季">冬季
				</select>
				
				</td>
			</tr>
			<tr>
				<td>开课学年</td>
				<td>
				<input type="text" name="year" id="cid" />
				</td>
			</tr>

			<tr>
				<td><button type="button" onclick="addCourse()">添加课程</button></td>
			</tr>
		</table>
	</form>
	<div id="footer" class="foot">
		<em style="color: white">[made by group four]</em>
	</div>
</body>
</html>